package com.xnx3.wangmarket.plugin.offlineWeixinNotification;

import com.xnx3.StringUtil;
import com.xnx3.j2ee.util.ConsoleUtil;
import com.xnx3.kefu.core.util.KefuPropertiesUtil;
import com.xnx3.weixin.WeiXinUtil;

/**
 * 全局
 * @author 管雷鸣
 *
 */
public class Global {
	public static WeiXinUtil weixin = null;
	public static String templateMessageId = "rGMqAfD4JugM-foyTLiP5Hl_IrNn4CxRpZ36kCet8BA";
	public static String weixinQRCode = "请配置kefu.properties 中的 kefu.plugin.offlineWeixinNotification.weixinQRCode";
	
	static {
		String appId = KefuPropertiesUtil.getProperty("kefu.plugin.offlineWeixinNotification.appId");
		String appSecret = KefuPropertiesUtil.getProperty("kefu.plugin.offlineWeixinNotification.appSecret");
		templateMessageId = KefuPropertiesUtil.getProperty("kefu.plugin.offlineWeixinNotification.templateMessageId");
		weixinQRCode = KefuPropertiesUtil.getProperty("kefu.plugin.offlineWeixinNotification.weixinQRCode");
		
		if(appId == null || appId.length() < 5 || appSecret == null || appSecret.length() < 5 || templateMessageId == null || templateMessageId.length() < 5) {
			ConsoleUtil.log("尚未配置离线消息微信自动推送提醒");
		}else {
			weixin = new WeiXinUtil(appId, appSecret);
			ConsoleUtil.log("已配置离线消息微信自动推送提醒");
		}
	}
	
}
